using Phoenix.Xna.Framework.Graphics.Models;

namespace Phoenix.Xna.Framework.Graphics.Animation
{
    public class SkeletonController : ISkeletonController, IBlendable
    {
        private SkinnedModelBoneDictionary _skeletonDictionary;

        public SkeletonController(SkinnedModelBoneDictionary skeletonDictionary)
        {
            _skeletonDictionary = skeletonDictionary;
            LocalBonePoses = new Pose[skeletonDictionary.Count];
            BlendWeight = 1.0f;
        }

        #region ISkeletonController Members

        public void SetBonePose(string channelName, ref Pose pose)
        {
            LocalBonePoses[_skeletonDictionary[channelName].Index] = pose;
        }

        public void SetBonePose(string channelName, Pose pose)
        {
            LocalBonePoses[_skeletonDictionary[channelName].Index] = pose;
        }

        #endregion

        #region IBlendable

        public float BlendWeight { get; set; }

        #endregion

        #region IHasLocalBonePoses

        public Pose[] LocalBonePoses { get; private set; }

        #endregion
    }
}